package com.zzzmode.httpjob.web.controller;

import com.jfinal.aop.Before;
import com.jfinal.core.Controller;
import com.jfinal.ext.interceptor.GET;
import com.jfinal.ext.interceptor.POST;
import com.jfinal.ext.interceptor.Restful;
import com.zzzmode.jobwork.dao.MongoConnectManager;
import com.zzzmode.jobwork.dao.TaskModelDAO;
import com.zzzmode.jobwork.utils.JsonUtil;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;


/**
 * Created by zl on 2014/12/6.
 */
public class IndexController extends BaseController {

    static Logger logger= LogManager.getLogger(IndexController.class);
    public void index(){
        TaskModelDAO taskModelDAO = MongoConnectManager.getTaskModelDAO();

        renderJson(JsonUtil.getGson().toJson(taskModelDAO.findAll()));
        logger.debug(getRequest().getHeader("User-Agent"));
        renderJsp("index.jsp");
    }


    public void show(){

        renderJsp("index.jsp");
    }
}
